import request from "../utils/request"

export const getTreeCategories = () => {
    return request({
        method: 'GET',
        url: '/api/product/category/list/tree'
    })
}

export const addCategory = params => {
    return request({
        method: 'POST',
        url: '/api/product/category/save',
        data: params
    })
}

export const delCategory = params => {
    return request({
        method: 'POST',
        url: `/api/product/category/delete/${params.id}`
    })
}

/* 批量删除 */
export const batchDelCategory = params => {
    return request({
        method: 'POST',
        url: '/api/product/attr-group/batchDelete',
        data: params
    })
}

/* 获取三级分类下的组属性 */
export const getAttrGroups = params => {
    return request({
        method: 'GET',
        url: `/api/product/attr-group/list/${params.catelogId}`,
        params: {
            key: params.key
        }
    })
}

/* 新增组属性 */
export const addAttrGroup = params => {
    return request({
        method: "POST",
        url: '/api/product/attr-group/save',
        data: params
    })
}
